<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%@include file="jsp/ets/common/common_head.jsp"%>
	<script>
		jQuery(document).ready(function() {
			jQuery("#loginForm").validationEngine({
				promptPosition : "centerRight"
			});
		});

		function replaceCode()
		{
			document.getElementById("picsss").src = "<%=request.getContextPath()%>/verifyCode.jsp?a="+ Math.random() ;
		}
		
		function checkSecurityCode()
		{
			var securityCode = $("#securityCode").val();
			
			
			//var code = $.get("verifyCode.jsp",{},function(data){alert(data);})
			
			if(securityCode ==  code)
			{
				alert(" <%=request.getSession(true).getAttribute("rand")%>");
				alert("securityCode="+securityCode+";code="+code);
				alert("yes");
			}
			alert("securityCode="+securityCode+";code="+code);
			//alert("no");
		}
		
		function rand()
		{
			var temp = Math.ceil()*(9999-1000)+1000;
			var inputHidden = $("#rand");
			inputHidden.value = temp;
			//alert(Math.random()*(9999-1000)+1000);
			//var $("#rand").val(Math.random()*(9999-1000)+1000); 
		}
		</script>
</head>

<body
	onload="MM_preloadImages('images/btnfirstfirst.png','images/btnsecondsecond.png')">
	${sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message }
	
	<% 
		
		String rand = (String)session.getAttribute("rand");
	
		String rand1 = (String)request.getSession(true).getAttribute("rand");
	
		request.setAttribute("rand", rand);
		request.setAttribute("rand1", rand1);
	
	%>
	
-------------------------	${rand } **************${rand1 }
	<form name="loginForm" id="loginForm" method="post"
		action="${pageContext.request.contextPath }/j_spring_security_check">
		
		<input type="hidden" id="rand" name="rand"/>
		<div class="logoone"></div>
		<div class="login"></div>
		<div class="textinputone">
			<input name="j_username" type="text" value="用户账号" class="textin " onfocus="onFocusFun(this,'用户账号');" onblur="onBlurFun(this,'用户账号');" />
		</div>
		<div class="textinputtwo">
			<input name="j_password" type="text" value="密码" class="textin " onfocus="onFocusFun(this,'密码');" onblur="onBlurFun(this,'密码');" />
		</div>
		<div class="textinputtwo">
			<input type="text" id="securityCode" value="验证码" class="textin" onfocus="onFocusFun(this,'验证码');" onblur="onBlurFun(this,'验证码'); checkSecurityCode();" />
			<img id="picsss" src="<%=request.getContextPath()%>/verifyCode.jsp" class="code" title="更换验证码" onclick="replaceCode();" />
		</div>
		<div><font color="red">${message }</font></div>
		<div class="btnbtn">
			<div class="btnfirst">
				<a href="#" onmouseout="MM_swapImgRestore()"
					onmouseover="MM_swapImage('Image1','','images/btnfirstfirst.png',1)"><img
					src="<%=request.getContextPath()%>/images/btnfirst.png" name="Image1" width="116" height="47"
					border="0" id="Image1" /> </a>
			</div>
			<div class="btnsecond">
				<a href="javascript:loginForm.submit()" onmouseout="MM_swapImgRestore()"
					onmouseover="MM_swapImage('Image2','','images/btnsecondsecond.png',1)"><img
					src="<%=request.getContextPath()%>/images/btnsecond.png" name="Image2" width="116" height="47"
					border="0" id="Image2" /> </a>
			</div>
		</div>
	</form>
</body>
</html>
